namespace Web.Control.WWW.Wiki
{
    using System;
    using System.Data;
    using System.Drawing;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI.WebControls;
    using System.Web.UI.HtmlControls;
    using Lx.Web.Common.UI;
    using Lx.Web.Common.ControlsUI;
    using System.Collections;
    using System.Collections.Generic;
    using System.Xml;
    using System.IO;

    using BLF;
    using BLF.WWW_WWW.Wiki;
    using Model.WWW_WWW.Wiki;

    public class Default : BaseControl
    {
        protected Literal lTages;
        protected Literal lLCount;
        protected Literal lUsers;

        protected Repeater rptTags;
        protected Repeater rptLB;
        protected Repeater rptUsers;

        protected override void OnLoad(EventArgs e)
        {
            int l = 10;
            if (lLCount!=null) int.TryParse(lLCount.Text, out l);
            int c= 10;
            if (lTages != null) int.TryParse(lTages.Text, out c);
            int u = 10;
            if (lUsers != null) int.TryParse(lUsers.Text, out u);

            ArrayList al = Wiki.GetDefaultData(l, c, u);
            if (rptLB != null)
            {
                rptLB.DataSource = (List<LearnLangInBaseLangInfo>)al[0];
                rptLB.DataBind();
            }
            if (rptTags != null)
            {
                rptTags.DataSource = (List<CategoryInfo>)al[1];
                rptTags.DataBind();
            }
            if (rptUsers != null)
            {
                rptUsers.DataSource = (List<UserInfo>)al[2];
                rptUsers.DataBind();
            }
            base.OnLoad(e);
        }

        protected string ReplaceTag(string tag)
        {
            if (string.IsNullOrEmpty(tag)) return tag;
            int k = tag.LastIndexOf("(");
            if (k < 0) return tag;
            return tag.Substring(0, k);
        }
    }
}
